#include QMK_KEYBOARD_H

enum Layers {
    _ALPHA,
    _LOWER,
    _RAISE,
    _ADJUST,
};

#define CTL_Z MT(MOD_LCTL, KC_Z)
#define CTL_M MT(MOD_RCTL, KC_M)
#define ALT_X MT(MOD_LALT, KC_X)
#define ALT_N MT(MOD_RALT, KC_N)
#define GUI_B MT(MOD_RGUI, KC_B)
#define LSF_SPC MT(MOD_LSFT, KC_SPC)
#define RSF_SPC MT(MOD_RSFT, KC_SPC)

#define LOW_C LT(_LOWER, KC_C)
#define RAI_V LT(_RAISE, KC_V)
#define ADJ_ENT LT(_ADJUST, KC_ENT)

#define ADJUST MO(_ADJUST)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  [_ALPHA] = LAYOUT(
      KC_Q,   KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,
      KC_A,   KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_BSPC,
      CTL_Z,  ALT_X,   LOW_C,   RAI_V,   LSF_SPC, RSF_SPC, GUI_B,   ALT_N,   CTL_M,   ADJ_ENT),


  [_LOWER] = LAYOUT(
      KC_ESC,  KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_HOME, KC_PGDN, KC_PGUP, KC_END,  KC_CAPS,
      KC_TAB,  KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_BSPC,
      KC_LCTL, KC_LALT, KC_TRNS, ADJUST,  LSF_SPC, RSF_SPC, KC_RGUI, KC_RALT, KC_RCTL, ADJ_ENT),


  [_RAISE] = LAYOUT(
      KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,
      KC_GRV,  KC_NO,   KC_MINS, KC_EQL,  KC_BSLS, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, KC_BSPC,
      KC_LCTL, KC_LALT, ADJUST,  KC_TRNS, LSF_SPC, RSF_SPC, KC_COMM, KC_DOT,  KC_SLSH, ADJ_ENT),


  [_ADJUST] = LAYOUT(
      KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,
      KC_F11,  KC_F12,  KC_NO,   KC_NO,   KC_NO,   KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_DEL,
      KC_LCTL, KC_LALT, KC_LGUI, KC_LSFT, KC_BTN1, KC_BTN1, KC_WH_U, KC_WH_D, KC_BTN2, KC_BTN3),

};
